
; The name of the installer
Name "fb2print one-button fb2 -> pdf converter"

; The file to write
OutFile "fb2print.exe"

; The default installation directory
InstallDir $PROGRAMFILES\fb2print

; Request application privileges for Windows Vista
RequestExecutionLevel user

;--------------------------------

; Pages

;Page components
;Page directory
Page instfiles

UninstPage uninstConfirm
UninstPage instfiles

;--------------------------------

; The stuff to install
Section ""

  SectionIn RO
  
  ; Set output path to the installation directory.
  SetOutPath $INSTDIR
  
  ; Put file there
  File /r dist\*
    
  ; Write the uninstall keys for Windows
  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\fb2print" "DisplayName" "fb2print one-button fb2 -> pdf converter"
  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\fb2print" "UninstallString" '"$INSTDIR\uninstall.exe"'
  WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\fb2print" "NoModify" 1
  WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\fb2print" "NoRepair" 1
  WriteUninstaller "uninstall.exe"
  
SectionEnd

; Optional section (can be disabled by the user)
Section "Start Menu Shortcuts"

  CreateDirectory "$SMPROGRAMS\fb2print"
  CreateShortCut "$SMPROGRAMS\fb2print\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0
  CreateShortCut "$SMPROGRAMS\fb2print\fb2 to pdf converter.lnk" "$INSTDIR\fb2print-gui.exe" "" "$INSTDIR\fb2print-gui.exe" 0
  
SectionEnd

;--------------------------------

; Uninstaller

Section "Uninstall"
  
  ; Remove registry keys
  DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\fb2print"

  ; Remove files and uninstaller
  RMDir /r "$INSTDIR"

  ; Remove shortcuts, if any
  Delete "$SMPROGRAMS\fb2print\*.*"

  ; Remove directories used
  RMDir "$SMPROGRAMS\fb2print"

SectionEnd
